<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>超标记录</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="example">
                            <table id="thisTable"
                                   data-height="480"
                                   data-striped="true"
                                   data-mobile-responsive="true"

                                   data-search="true"
                                   data-search-align="left"

                                   data-pagination="true"
                                   data-page-size="10"
                                   data-show-pagination-switch="true"

                                   data-show-refresh="true"
                                   data-show-toggle="true"

                                   data-sortable="true"
                                   data-sort-name="id"
                                   data-sort-order="asc"
                                   data-silent-sort="false">
                                <thead>
                                    <tr>
                                        <th data-radio="true"></th>
                                        <th data-field="date" data-sortable="true">日期</th>
                                        <th data-field="terminalid" data-sortable="true">终端编号</th>
                                        <th data-field="pointid" data-sortable="true">采集点编号</th>
                                        <th data-field="h2s" data-sortable="true">超标浓度</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>历史超标排行榜</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div id="main" class="row" style="height: 700px;margin-top: 20px;"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>

    <!-- Bootstrap table -->
    <script src="js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="js/plugins/bootstrap-table/extensions/export/tableExport.js"></script>
    <script src="js/plugins/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
    <script src="js/plugins/echarts/echarts.js"></script>

    <script>
        var dataUrl = "http://localhost:64752/api/count/overproof?h2s=99.9&optime=1900-01-01&edtime=2100-01-01";
        var exportFileName = "超标记录导出表";
    </script>

    <script>
        $("#thisTable").bootstrapTable({
            url: dataUrl,
            showExport: true,
            exportTypes: ['excel', 'csv', 'json'],
            exportOptions: {
                fileName: exportFileName
            }
        });
    </script>


    <script>
        var myChart = echarts.init(document.getElementById('main'));

        function paihang () {
            $.get("http://localhost:64752/api/count/pointover?h2s=99.9&optime=1900-01-01&edtime=2100-01-01", function (list) {
                var pointlist = list.map(function (item) {
                    return item.terminalid + '号终端 ' + item.pointid + '号采集点';
                });
                var countlist = list.map(function (item) {
                    return item.count;
                });
                console.log(pointlist);
                console.log(countlist);
                var option = {
                    title: {
                        text: '超标排行榜'
                    },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },
                    legend: {
                        data: ['超标天数']
                    },
                    xAxis: {
                        type: 'value',
                        boundaryGap: false
                    },
                    yAxis: {
                        type: 'category',
                        data: pointlist.reverse()
                    },
                    series: [
                        {
                            name: '超标天数',
                            type: 'bar',
                            data: countlist.reverse()
                        }
                    ]
                };
                myChart.setOption(option);
            });
        }

        paihang();


    </script>
</body>

</html>
